home *** CD-ROM | disk | FTP | other *** search
/ OpenGL Superbible (2nd Edition) / OpenGL SuperBible e2.iso / tools / GLUT-3.7 / LIB / GLUT / glut_winmisc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-12  |  2.9 KB  |  121 lines

  1.  
  2. /* Copyright (c) Mark J. Kilgard, 1994.  */
  3.  
  4. /* This program is freely distributable without licensing fees
  5.    and is provided without guarantee or warrantee expressed or
  6.    implied. This program is -not- in the public domain. */
  7.  
  8. #include <stdlib.h>
  9. #include <stdio.h>
  10. #include <string.h>
  11. #include <assert.h>
  12.  
  13. #if !defined(_WIN32)
  14. #include <X11/Xlib.h>
  15. #include <X11/Xutil.h>
  16. #include <X11/Xatom.h>  /* for XA_STRING atom */
  17. #endif
  18.  
  19. #include "glutint.h"
  20.  
  21. /* CENTRY */
  22. void APIENTRY 
  23. glutSetWindowTitle(const char *title)
  24. {
  25.   XTextProperty textprop;
  26.  
  27.   assert(!__glutCurrentWindow->parent);
  28.   IGNORE_IN_GAME_MODE();
  29.   textprop.value = (unsigned char *) title;
  30.   textprop.encoding = XA_STRING;
  31.   textprop.format = 8;
  32.   textprop.nitems = strlen(title);
  33.   XSetWMName(__glutDisplay,
  34.     __glutCurrentWindow->win, &textprop);
  35.   XFlush(__glutDisplay);
  36. }
  37.  
  38. void APIENTRY 
  39. glutSetIconTitle(const char *title)
  40. {
  41.   XTextProperty textprop;
  42.  
  43.   assert(!__glutCurrentWindow->parent);
  44.   IGNORE_IN_GAME_MODE();
  45.   textprop.value = (unsigned char *) title;
  46.   textprop.encoding = XA_STRING;
  47.   textprop.format = 8;
  48.   textprop.nitems = strlen(title);
  49.   XSetWMIconName(__glutDisplay,
  50.     __glutCurrentWindow->win, &textprop);
  51.   XFlush(__glutDisplay);
  52. }
  53.  
  54. void APIENTRY 
  55. glutPositionWindow(int x, int y)
  56. {
  57.   IGNORE_IN_GAME_MODE();
  58.   __glutCurrentWindow->desiredX = x;
  59.   __glutCurrentWindow->desiredY = y;
  60.   __glutCurrentWindow->desiredConfMask |= CWX | CWY;
  61.   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK);
  62. }
  63.  
  64. void APIENTRY 
  65. glutReshapeWindow(int w, int h)
  66. {
  67.   IGNORE_IN_GAME_MODE();
  68.   if (w <= 0 || h <= 0)
  69.     __glutWarning("glutReshapeWindow: non-positive width or height not allowed");
  70.  
  71.   __glutCurrentWindow->desiredWidth = w;
  72.   __glutCurrentWindow->desiredHeight = h;
  73.   __glutCurrentWindow->desiredConfMask |= CWWidth | CWHeight;
  74.   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK);
  75. }
  76.  
  77. void APIENTRY 
  78. glutPopWindow(void)
  79. {
  80.   IGNORE_IN_GAME_MODE();
  81.   __glutCurrentWindow->desiredStack = Above;
  82.   __glutCurrentWindow->desiredConfMask |= CWStackMode;
  83.   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK);
  84. }
  85.  
  86. void APIENTRY 
  87. glutPushWindow(void)
  88. {
  89.   IGNORE_IN_GAME_MODE();
  90.   __glutCurrentWindow->desiredStack = Below;
  91.   __glutCurrentWindow->desiredConfMask |= CWStackMode;
  92.   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK);
  93. }
  94.  
  95. void APIENTRY 
  96. glutIconifyWindow(void)
  97. {
  98.   IGNORE_IN_GAME_MODE();
  99.   assert(!__glutCurrentWindow->parent);
  100.   __glutCurrentWindow->desiredMapState = IconicState;
  101.   __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK);
  102. }
  103.  
  104. void APIENTRY 
  105. glutShowWindow(void)
  106. {
  107.   IGNORE_IN_GAME_MODE();
  108.   __glutCurrentWindow->desiredMapState = NormalState;
  109.   __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK);
  110. }
  111.  
  112. void APIENTRY 
  113. glutHideWindow(void)
  114. {
  115.   IGNORE_IN_GAME_MODE();
  116.   __glutCurrentWindow->desiredMapState = WithdrawnState;
  117.   __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK);
  118. }
  119.  
  120. /* ENDCENTRY */
  121.